home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-03 / vbterm.zip / TX.FRM (.txt) < prev    next >
Visual Basic Form  |  1991-09-01  |  6KB  |  114 lines

  1. XMODEM Transmit
  2. Form1
  3. Label1
  4. Uploading:
  5. filename
  6. filename
  7. Label2
  8. Bytes: So Far/Total:
  9. bytes
  10. bytes
  11. Label3
  12. Errors: Recent/Total:
  13. errors
  14. errors
  15. CommandAbort
  16. Abort
  17. Form_Click
  18. Form_Paint
  19. nextpacket
  20. checksum:
  21. filenumber[
  22. filename3
  23. caption
  24. serialbinary
  25. GetTickCountB
  26. timeout
  27. SerialRead
  28. CTRLZ
  29. serialwrite
  30. ErrorTotal
  31. ErrorRecent
  32. UpdateStats
  33. errors
  34. errorsrecent
  35. errorstotal
  36. BytesTotal
  37. BytesSoFar
  38. bytesE
  39. CommandAbort_Click
  40.     AbortFlag
  41. FALSE
  42. CanCount
  43.     InterLock
  44. BufSizeg
  45. waitack_
  46. GetResponse
  47. selecte
  48. FillBuffer
  49. buffer
  50. fileno
  51. Received
  52. pring
  53. Num2Read
  54.    TX.FRMM
  55.  This is the code to handle the XMODEM Transmission
  56.    Charles McGuinness [76701,11]
  57.    Constants used in the XMODEM protocol.  See RX.FRM for definitionsn
  58.  In case of parity
  59. Form_Paint
  60.    This is the routine we use to transmit a file....
  61.  Next packet to send
  62.  temp var to comput checksum
  63.  File we're reading from
  64.  Buffer to hold data we're sending
  65.  Counter to time out receivers
  66.  Temp var to hold a byte of data
  67.  How much data read 
  68.  How many CANs (^X) in a row
  69.  To prevent re-entrancya
  70.  Are we already running? If so, bail out
  71.  Open filename.caption For Input Access Read As filenumber
  72. Unable to open "
  73.  How much to send in total
  74.  Before we start waiting for the first NAK, we should read and discard any
  75.  data already buffered.  Otherwise, we might find three NAKs (for example)
  76.  waiting for us already that could confuse the protocol.
  77.    Wait for first NAK to start us off
  78. Receiver never started
  79. Receiver aborted
  80.    Main Transmitting loop 
  81.  On each iteration of this loop, another (new) buffer is sentK
  82.  OK, let's send the next packet of data!
  83.  Get the data from the filec
  84.  On each iteration of this loop, the same buffer is sent
  85.  Was there no more data??l
  86.  No data!s
  87.  Tell receiver we're done!
  88.  Write the data packet
  89.    Wait for ACK/NAK
  90. Receiver timed out
  91. Receiver aborted
  92. Too Many Errors"
  93. UpdateStats
  94.  Updates the form with the current status 
  95. CommandAbort_Click
  96.    The user has clicked the abort button....
  97. GetResponse
  98.    This function gets the handshake from the remote computer..
  99.    The handshake can be either::
  100.  An ACK charactera
  101.  A NAK character
  102.  Two CANs in a row
  103.    The routine will return the character recieved (i.e., ACK, NAK, or CAN)
  104.    or will return -1 if the link times out..
  105.  Data received
  106.  When we started waiting
  107.  Counter for two CANs in a row
  108. Debug.Print "Response is abort"p
  109. Debug.Print "Response is time out"
  110. Debug.Print "Response is CAN" 
  111.  Is the other end aborting the transfer?
  112. Debug.Print "Response is ACK/NAK ("; Asc(byte); ")"i
  113. FillBuffer
  114.